package com.pig4cloud.pigx.wxApi.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pig4cloud.pigx.common.core.util.R;
import com.pig4cloud.pigx.common.security.annotation.Inner;
import com.pig4cloud.pigx.ruralLibrary.api.entity.ResourceEntity;
import com.pig4cloud.pigx.wxApi.entity.BookExposureEntity;
import com.pig4cloud.pigx.wxApi.service.appInterfaceService;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequiredArgsConstructor
@RequestMapping("/appInterface")
@Tag(description = "appInterfaceController", name = "app接口")
public class appInterfaceController {

    private final appInterfaceService service;

    /**
     * 首页分类查询资源
     *
     * @return
     */

    @GetMapping("/getProductResources")
    @Inner(value = false)
    public R getProductResources() {
        return service.getProductResources();
    }


    @GetMapping("/getTypeResources/{id}")
    @Inner(value = false)
    public R getTypeResources(@PathVariable("id" ) Long id) {
        return service.getTypeResources(id);
    }

    @GetMapping("/getResources")
    @Inner(value = false)
    public R getResources(Page page, Long id) {
        return service.getResources(id,page);
    }

    @GetMapping("/downloadAndParseEpub")
    @Inner(value = false)
    public ResponseEntity<String> downloadAndParseEpub(String url) {
        return service.downloadAndParseEpub(url);
    }
}
